
/**
 * 作者: hxl
 * 日期: 2025-05-30 17:21:59
 * 备注: 用户联盟乱斗商店数据表
 */
package com.motu.monstercity.server.game.userdata;

import com.motu.vertx.module.utility.model.EntityManager;
import com.motu.vertx.module.utility.toolset.TimeUtils;

public class UserUnionScuffleShopWeek extends UserUnionScuffleShopWeekModel {
    public UserUnionScuffleShopWeek() {
        super();
    }
    public UserUnionScuffleShopWeek(long userId, int shopId, int buyNum) {
        putUserId(userId);
        putShopId(shopId);
        putBuyNum(buyNum);
    }

    public void reset() {
        boolean update = false;
        if (!TimeUtils.isToday(dayResetTime)) {
            putDayBuyNum(0);
            putDayResetTime(TimeUtils.getCurTime());
            update = true;
        }
        if (!TimeUtils.isSameWeek(weekResetTime, TimeUtils.getCurTime())) {
            putBuyNum(0);
            putWeekResetTime(TimeUtils.getCurTime());
            update = true;
        }
        if (update) {
            update();
        }
    }

}
